Conversation
| } | ||
| const markets = clearingHouse.getMarketsAccount(); | ||
|
|
||
| const markets_with_position = clearingHouseUser |
There was a problem hiding this comment.
needs to be camelCase
|
|
||
| // convient check/message for too many positions/orders across markets | ||
| if ( | ||
| markets_with_position.length >= 5 && |
There was a problem hiding this comment.
will never be greater than 5, can probably make it marketsWithPosition.length === 5
|
|
||
| const markets_with_position = clearingHouseUser | ||
| .getUserPositionsAccount() | ||
| .positions.map((position) => { |
There was a problem hiding this comment.
should filter out the markets where base asset amount is zero. Right now this will always say it's five positions?
| // convient check/message for too many positions/orders across markets | ||
| if ( | ||
| markets_with_position.length >= 5 && | ||
| !markets_with_position.includes(orderMarket) |
There was a problem hiding this comment.
if the order doesnt exist in marketsWithPosition, should probably add it so we can keep track of number of positions after orders are canceled and then replaced
| }); | ||
|
|
||
| // cancel all open orders before placing new ones | ||
| // if (userOrdersAccountExists && numOpenOrders > 0) { |
There was a problem hiding this comment.
should just assumed userOrdersAccountExists exists
| 0, | ||
| postOnly, | ||
| ZERO, | ||
| false //ioc |
There was a problem hiding this comment.
need to upgrade the package.json to at least use 0.1.29 for sdk
| const clearingHousePublicKey = new PublicKey( | ||
| sdkConfig.CLEARING_HOUSE_PROGRAM_ID | ||
| ); | ||
| const clearingHouse = Admin.from( |
There was a problem hiding this comment.
this shouldnt be using Admin. can we use getClearingHouse
No description provided.